package cn.ekuma.epos.datalogic.hessian;

import java.net.MalformedURLException;

import cn.ekuma.data.dao.I_DataLogic;
import cn.ekuma.epos.datalogic.I_DataLogicAdmin;
import cn.ekuma.epos.datalogic.I_DataLogicCustomers;
import cn.ekuma.epos.datalogic.I_DataLogicERP;
import cn.ekuma.epos.datalogic.I_DataLogicReceipts;
import cn.ekuma.epos.datalogic.I_DataLogicSales;
import cn.ekuma.epos.datalogic.I_DataLogicSystem;
import com.caucho.hessian.client.HessianProxyFactory;
//import com.exadel.flamingo.java.hessian.client.FlamingoHessianProxyFactory;

public class HessianDataLogicHelper {

	public static I_DataLogicERP dlERP;
	public static I_DataLogicSales dlSales;
	public static I_DataLogic dataLogic;
	public static I_DataLogicReceipts dlReceipts;
	public static I_DataLogicSystem dlSystem;
	public static I_DataLogicAdmin dlAdmin;
	public static I_DataLogicCustomers dlCustomers;
	
	
		public static void init(String serviceAddr) throws MalformedURLException{
			 HessianProxyFactory  factory=new HessianProxyFactory();
			 //FlamingoHessianProxyFactory factory = new FlamingoHessianProxyFactory();
			 factory.setHessian2Reply(true);
			 //factory.setReadTimeout(5000);//网络超时
			 factory.setOverloadEnabled(true);//函数重载

			 dlERP = (I_DataLogicERP) factory.create(I_DataLogicERP.class, serviceAddr+"/DataLogicERP");
			 dlSales=(I_DataLogicSales) factory.create(I_DataLogicERP.class, serviceAddr+"/DataLogicSale");
			 dlReceipts=(I_DataLogicReceipts)factory.create(I_DataLogicReceipts.class, serviceAddr+"/DataLogicReceipt");
			 dlSystem=(I_DataLogicSystem)factory.create(I_DataLogicSystem.class, serviceAddr+"/DataLogicSystem");
			 dlAdmin=(I_DataLogicAdmin) factory.create(I_DataLogicAdmin.class, serviceAddr+"/DataLogicAdmin");
			 dlCustomers=(I_DataLogicCustomers) factory.create(I_DataLogicCustomers.class, serviceAddr+"/DataLogicCustomer");		 
		}
	  
		public static I_DataLogicERP getDLERP(){
			return dlERP;
		}
		
		public static I_DataLogicSales getDLSales(){
			return dlSales;
		}
		
		public static I_DataLogic  getDataLogic(){
			return dlERP;
		}
		
		public static I_DataLogicReceipts getDLReceipts(){
			return dlReceipts;
		}
		
		public static I_DataLogicSystem getDLSystem(){
			return dlSystem;
		}
		
		public static I_DataLogicAdmin getDLAdmin(){
			return dlAdmin;
		}
		
		public static I_DataLogicCustomers getDLCustomer(){
			return dlCustomers;
		}
		
}
